package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.HangBean;
import com.xuxin.nantai.contract.HangContract;
import com.xuxin.nantai.model.HangModel;

/**
 * Created by xu_xin
 * Created on 2020.06.18 0018
 */
public class HangPresenter implements HangContract.Presenter {
    private HangModel model;
    private HangContract.View view;

    public HangPresenter(HangContract.View view) {
        model = new HangModel();
        this.view = view;
    }

    @Override
    public void getHang(String LoginName, String ProductInfo, String InspectorInfo, int PageIndex) {
        if (null != model) {
            model.getHang(this, LoginName, ProductInfo, InspectorInfo, PageIndex);
        }
    }

    @Override
    public void delete(String UserName, String Guid) {
        if (null != model) {
            model.delete(this, UserName, Guid);
        }
    }

    @Override
    public void onSuccess(HangBean hangBean) {
        if (null != view) {
            view.onSuccess(hangBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}